import { defineStore } from "pinia";

export const useStore = defineStore("main", {
  state: () => {
    return {
      language: localStorage.getItem('locale') || "",
    };
  },

  actions: {
    chnageLanguage(payload: any) {
      if (payload === "中文") {
        this.language = "zh-CN";
      } else if (payload === "English") {
        this.language = "en-US";
      }
      localStorage.setItem("locale", this.language as any);
    },
  },
});

export default useStore;
